//package com.xqboss.chain.bsn;
//
//import com.reddate.wuhanddc.DDCSdkClient;
//import com.reddate.wuhanddc.listener.SignEventListener;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.math.BigInteger;
//
//
//@Slf4j
//@Component
//public class DDC1155ServiceUtil {
//
//    @Value("${custom.nft.sendAddress}")
//    String sendAddress;
//
//
//    /**
//     * 生成ddc
//     *
//     * @param to
//     * @param ddcUri 如果要在官方DDC显示出URL，那DDCURI中需增加url或image字段，如ddcURI="{\"url\":\"https://ddc.bsnbase.com/main/index\"}"
//     * @param data   附加数据
//     * @throws Exception
//     */
//   public String safeMint(Long userId, String to, String ddcUri, byte[] data) throws Exception {
//        SignEventListener signEventListener = event -> AuthorityServiceUtil.transactionSignature(event.getSender(), event.getRawTransaction());
//        DDCSdkClient ddcSdkClient = DDCSdkClient.builder().setSignEventListener(signEventListener).build();
//        String tx = ddcSdkClient.ddc1155Service.safeMint(sendAddress, to, BigInteger.ONE, ddcUri, data);
//        log.info(userId + ",safeMint:::" + tx);
////        assertNotNull(tx);
//       return tx;
//    }
//
//
//    /**
//     * DDC的转移
//     *
//     * @param from    拥有者账户
//     * @param to      接收者账户
//     * @param ddcId   DDCID
//     * @param data    附加数据
//     * @return 转移结果
//     * @throws Exception Exception
//     */
//    public String safeTransferFrom(Long userId,String fromPrivate, String from, String to,BigInteger ddcId, byte[] data) throws Exception {
//        SignEventListener signEventListener = event -> AuthorityServiceUtil.transactionSignature(fromPrivate, event.getRawTransaction());
//        DDCSdkClient ddcSdkClient =  DDCSdkClient.builder().setSignEventListener(signEventListener).build();
//        String tx = ddcSdkClient.ddc1155Service.safeTransferFrom(from, from, to, ddcId, new BigInteger("1"), data);
//        log.info(tx);
//        return tx;
//    }
//
//
//
//
////
////    @Test
////    void safeMintBatch() throws Exception {
////        try {
////            byte[] data = new byte[1];
////            data[0] = 1;
////            Multimap<BigInteger, String> map = ArrayListMultimap.create();
////            map.put(new BigInteger("11"), "11");
////            map.put(new BigInteger("22"), "12");
////
////            String tx = ddcSdkClient.ddc1155Service.safeMintBatch(sender, "0x24a95d34dcbc74f714031a70b077e0abb3308088", map, data);
////            log.info(tx);
//////            assertNotNull(tx);
////        } catch (DDCException e) {
////            System.out.println(e.getMsg());
////        }
////    }
////
////
////    @Test
////    void setApprovalForAll() throws Exception {
////        String tx = ddcSdkClient.ddc1155Service.setApprovalForAll(sender, "0x24a95d34dcbc74f714031a70b077e0abb3308088", true);
////        log.info(tx);
//////        assertNotNull(tx);
////
////    }
////
////    @Test
////    void isApprovedForAll() throws Exception {
////        Boolean tx = ddcSdkClient.ddc1155Service.isApprovedForAll("0x24a95d34dcbc74f714031a70b077e0abb3308088", "0x4655399c9c082304fe7a0af145c490f52d87d732");
////        log.info(String.valueOf(tx));
//////        assertNotNull(tx);
////    }
////
////
////
////    @Test
////    void safeBatchTransferFrom() throws Exception {
////        byte[] data = new byte[1];
////        data[0] = 1;
////        ArrayList<byte[]> datas = new ArrayList<>();
////        datas.add(data);
////
////        Map<BigInteger, BigInteger> ddcInfos = new HashMap<>();
////        ddcInfos.put(new BigInteger("7"), new BigInteger("1"));
////        String tx = ddcSdkClient.ddc1155Service.safeBatchTransferFrom(sender, "0x24a95d34dcbc74f714031a70b077e0abb3308088", "0x4655399c9c082304fe7a0af145c490f52d87d732", ddcInfos, datas);
////        log.info(tx);
//////        assertNotNull(tx);
////    }
////
////    @Test
////    void freeze() throws Exception {
////        String tx = ddcSdkClient.ddc1155Service.freeze(sender, new BigInteger("7"));
////        log.info(tx);
//////        assertNotNull(tx);
////    }
////
////    @Test
////    void unFreeze() throws Exception {
////        String tx = ddcSdkClient.ddc1155Service.unFreeze(sender, new BigInteger("7"));
////        log.info(tx);
//////        assertNotNull(tx);
////    }
////
////    @Test
////    void burn() throws Exception {
////        String tx = ddcSdkClient.ddc1155Service.burn(sender, "0x24a95d34dcbc74f714031a70b077e0abb3308088", new BigInteger("203"));
////        log.info(tx);
//////        assertNotNull(tx);
////    }
////
////    @Test
////    void burnBatch() throws Exception {
////        ArrayList<BigInteger> arrayList = new ArrayList();
////        arrayList.add(new BigInteger("6"));
////        arrayList.add(new BigInteger("7"));
////
////        String tx = ddcSdkClient.ddc1155Service.burnBatch(sender, "0x24a95d34dcbc74f714031a70b077e0abb3308088", arrayList);
////        log.info(tx);
//////        assertNotNull(tx);
////    }
////
////    @Test
////    void balanceOf() throws Exception {
////        BigInteger bigInteger = ddcSdkClient.ddc1155Service.balanceOf("0x24a95d34dcbc74f714031a70b077e0abb3308088", new BigInteger("1"));
////        log.info(bigInteger.toString());
//////        assertNotNull(bigInteger);
////    }
////
////    @Test
////    void balanceOfBatch() throws Exception {
////        Multimap<String, BigInteger> map = ArrayListMultimap.create();
////        for (int i = 82; i < 85; i++) {
////            map.put("0x24a95d34dcbc74f714031a70b077e0abb3308088", new BigInteger(String.valueOf(i)));
////        }
////
////        List<BigInteger> bigIntegerList = ddcSdkClient.ddc1155Service.balanceOfBatch(map);
//////        assertNotNull(bigIntegerList);
////        bigIntegerList.forEach(t -> {
////            log.info(String.valueOf(t));
////        });
////    }
////
////    @Test
////    void ddcURI() throws Exception {
////        String result = ddcSdkClient.ddc1155Service.ddcURI(new BigInteger("7"));
//////        assertNotNull(result);
////        log.info("URL: {}", result);
////    }
////
////    @Test
////    void setURI() throws Exception {
////        String tx = ddcSdkClient.ddc1155Service.setURI(sender ,new BigInteger(""),"");
////        log.info(tx);
//////        assertNotNull(tx);
////
////    }
//
//}